/*
  Author: LQX
  Date:   2011-3-29
  Description: 
*/

#pragma once 
#import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
#include "Computer.h"
#include "Student.h"

class DBUtil
{
private:
	_ConnectionPtr m_pConn;
	_bstr_t conStr;

public:
	DBUtil();
	~DBUtil();
	BOOL connect();
	void disconnect();

public:
	// for student table operation
	bool insertStudent(Student* stu);
	bool modifyStudent(Student* stu);
	Student* getStudentByID(CString studentNumber);
	bool deleteStudent(Student* stu);
	_RecordsetPtr get_RecordsetByStudentID(CString studentNumber);

public:
	bool insertComputer(Computer* com);
	bool modifyComputer(Computer* com);
	bool deleteComputer(Computer* com);
	Computer* getComputerByID(CString rfidNumber);
	vector<Computer*> getComputerByStudentID(CString studentNumber);
	_RecordsetPtr get_RecordsetByComputerID(CString rfidNumber);

};